infra-monitoring.ts 755 B

12345678910111213141516171819202122232425262728
  1. import { NextApiRequest, NextApiResponse } from 'next'
  2. import apiWrapper from '@/lib/api/apiWrapper'
  3. export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
  4. async function handler(req: NextApiRequest, res: NextApiResponse) {
  5. const { method } = req
  6. switch (method) {
  7. case 'GET':
  8. return handleGetAll(req, res)
  9. default:
  10. res.setHeader('Allow', ['GET'])
  11. res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
  12. }
  13. }
  14. const handleGetAll = async (_req: NextApiRequest, res: NextApiResponse) => {
  15. // Platform specific endpoint
  16. const response = {
  17. data: [],
  18. yAxisLimit: 0,
  19. format: '%',
  20. total: 0,
  21. }
  22. return res.status(200).json(response)
  23. }